package com.javaGather.demo;

import java.util.Iterator;
import java.util.LinkedList;

public class Test1 {
    public static void main(String[] args) {

        /**
         * LinkedList
         * 底层基于链表数据结构
         *
         */

        LinkedList<String> strings = new LinkedList<>();
        strings.add("Hello");
        strings.add("World");
        strings.add("Java");
//        System.out.println(strings.get(1));

        Iterator<String> iterator = strings.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
        System.out.println("----------------------------");

        strings.remove(1);

        Iterator<String> iterator1 = strings.iterator();
        while (iterator1.hasNext()) {
            System.out.println(iterator1.next());
        }

    }
}
